﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Copy5x
{
    public enum LogType { Error, Warning, Trace };

    public class Logger
    {
        public static string Formate = "$$msg$$";
        public static string FormateWithTime = "[$$time$$]\t$$msg$$";

        public static void Log(string msg, LogType type, bool showTimer)
        {
            msg = (showTimer) ? msg.Replace("$$msg$$", msg).Replace("$$time$$", DateTime.Now.ToLongTimeString()) : msg.Replace("$$msg$$", msg);

            ConsoleColor color = ConsoleColor.White;

            if (type == LogType.Error)
                color = ConsoleColor.Red;
            else if (type == LogType.Warning)
                color = ConsoleColor.Green;

            Console.ForegroundColor = color;
            Console.WriteLine(msg);
            Console.ForegroundColor = ConsoleColor.White;
        }

        public static void Log(string msg)
        {
            Log(msg, LogType.Trace, false);
        }

        public static void Log(Exception exp)
        {
            Log(exp.ToString(), LogType.Error, false);
        }

    }
}
